<aside class="left-side sidebar-offcanvas">                
  <!-- sidebar: style can be found in sidebar.less -->
  <section class="sidebar">
      <!-- Sidebar user panel -->
      <!--
      <div class="user-panel">
          <div class="pull-left image">
              <img src="" class="img-circle" alt="User Image" />
          </div>
          <div class="pull-left info">
              <p>Hello, Jane</p>

              <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
          </div>
      </div>
    	-->
      <!-- search form -->
      <!-- <form action="#" method="get" class="sidebar-form">
          <div class="input-group">
              <input type="text" name="q" class="form-control" placeholder="Search..."/>
              <span class="input-group-btn">
                  <button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
              </span>
          </div>
      </form> -->
      <!-- /.search form -->
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <ul class="sidebar-menu">
          <!--<li class="active">
              <a href="#">
                  <i class="fa fa-dashboard"></i> <span>Administración</span>
              </a>
          </li> -->
          <li class="treeview">

            <a href="#">
              <i class="fa fa-dashboard"></i>
              <span>Administración</span>
              <i class="fa fa-angle-left pull-right"></i>
            </a>
            
            <ul class="treeview-menu">
              <li>
                <?php
                  echo $this->Html->link('<i class="fa fa-angle-double-right"></i> Deudas', 
                  array('controller' => 'services', 'action' => 'index' ), 
                  array('escape' => false)
                );?>
              </li>
              <li>
                <?php
                  echo $this->Html->link('<i class="fa fa-angle-double-right"></i> Pagos', 
                  array('controller' => 'invoices', 'action' => 'index' ), 
                  array('escape' => false)
                );?>
              </li>
              <li>
                <?php
                  echo $this->Html->link('<i class="fa  fa-tasks"></i> Mediciones', 
                  array('controller' => 'measures', 'action' => 'index' ), 
                  array('escape' => false)
                );?>
              </li>
              <!--<li class='hidden'>
               
                <li class="treeview">
                   <?php
                    echo $this->Html->link('<i class="fa fa-angle-double-right"></i> Vencimientos', 
                    array('controller' => 'members', 'action' => 'index' ), 
                    array('escape' => false)
                  );?>
                  <ul class="treeview-menu" id='years_ul'>                    
                  </ul>
                </li>
              </li>
              -->  
            </ul>
          </li>
          <li>            
            <?php
                echo $this->Html->link('<i class="fa fa-users"></i> <span>Socios</span>', 
                array('controller' => 'members', 'action' => 'index' ), 
                array('escape' => false)
              );            
            ?>             
          </li>
          <li>            
            <?php
                echo $this->Html->link('<i class="fa fa-users"></i> <span>Servicios</span>', 
                array('controller' => 'services', 'action' => 'index' ), 
                array('escape' => false)
              );            
            ?>             
          </li>
          <li class="treeview">

            <a href="#">
                <i class="fa fa-calendar"></i>
                <span>Periodos</span>
                <i class="fa fa-angle-left pull-right"></i>
            </a>

            <ul class="treeview-menu">
              <li>
                <?php
                  echo $this->Html->link('<i class="fa fa-angle-double-right"></i> Carga', 
                  array('controller' => 'periods', 'action' => 'index' ), 
                  array('escape' => false)
                );?>
              </li>
              
              <!--<li class='hidden'>
               
                <li class="treeview">
                   <?php
                    echo $this->Html->link('<i class="fa fa-angle-double-right"></i> Vencimientos', 
                    array('controller' => 'members', 'action' => 'index' ), 
                    array('escape' => false)
                  );?>
                  <ul class="treeview-menu" id='years_ul'>                    
                  </ul>
                </li>
              </li>
              -->  
            </ul>
          </li>

          
          <!-- 
          <li class="treeview">
              <a href="#">
                  <i class="fa fa-edit"></i> <span>Forms</span>
                  <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
                  <li><a href="pages/forms/general.html"><i class="fa fa-angle-double-right"></i> General Elements</a></li>
                  <li><a href="pages/forms/advanced.html"><i class="fa fa-angle-double-right"></i> Advanced Elements</a></li>
                  <li><a href="pages/forms/editors.html"><i class="fa fa-angle-double-right"></i> Editors</a></li>                                
              </ul>
          </li>
          <li class="treeview">
              <a href="#">
                  <i class="fa fa-table"></i> <span>Tables</span>
                  <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
                  <li><a href="pages/tables/simple.html"><i class="fa fa-angle-double-right"></i> Simple tables</a></li>
                  <li><a href="pages/tables/data.html"><i class="fa fa-angle-double-right"></i> Data tables</a></li>
              </ul>
          </li>
          <li>
              <a href="pages/calendar.html">
                  <i class="fa fa-calendar"></i> <span>Calendar</span>
                  <small class="badge pull-right bg-red">3</small>
              </a>
          </li>
          <li>
              <a href="pages/mailbox.html">
                  <i class="fa fa-envelope"></i> <span>Mailbox</span>
                  <small class="badge pull-right bg-yellow">12</small>
              </a>
          </li>
          <li class="treeview">
              <a href="#">
                  <i class="fa fa-folder"></i> <span>Examples</span>
                  <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
                  <li><a href="pages/examples/invoice.html"><i class="fa fa-angle-double-right"></i> Invoice</a></li>
                  <li><a href="pages/examples/login.html"><i class="fa fa-angle-double-right"></i> Login</a></li>
                  <li><a href="pages/examples/register.html"><i class="fa fa-angle-double-right"></i> Register</a></li>
                  <li><a href="pages/examples/lockscreen.html"><i class="fa fa-angle-double-right"></i> Lockscreen</a></li>
                  <li><a href="pages/examples/404.html"><i class="fa fa-angle-double-right"></i> 404 Error</a></li>
                  <li><a href="pages/examples/500.html"><i class="fa fa-angle-double-right"></i> 500 Error</a></li>                                
                  <li><a href="pages/examples/blank.html"><i class="fa fa-angle-double-right"></i> Blank Page</a></li>
              </ul>
          </li>-->
      </ul>
  </section>
  <!-- /.sidebar -->
</aside>

<script type="text/javascript">
  function get_year(){
    $.get( "/periods/get_years", function( data ) 
    {
      console.debug("==> Result : %o",data);
      var obj = JSON.parse( data );
      console.debug("==> Result : %o",obj);
      $.each( obj, function( i, l ){
        $("#years_ul").append('<li style="margin-left:20px;"><a href="#"><i class="fa fa-angle-double-right"></i> '+l+'</a></li>');
      });
    });
  }


  
</script>